//=======================打印函数
   function printEntryInspect(isTemplate,printType){
	   var jyjyId = $("#jyjyId").attr("value");
	   if(jyjyId){
		   doInspectPrint(jyjyId,isEntry,isTemplate,printType);
	   }else{
		    $.messager.alert('提示',"未获取到检验检疫单主键,请先暂存或者报检申报后打印");
	   }
   }
   function printEntryDeclare(printType){
        var baHgbaseinfoId = $("#baHgbaseinfoId").attr("value");
       if(baHgbaseinfoId){
            doDeclarePrint(baHgbaseinfoId,isEntry,printType);  
       }else{
           $.messager.alert('提示',"未获取到报关单主键,请先暂存或者上载后打印");
       }
   }
   function doInspectPrint(jyjyId,isEntry,isTemplate,printType){
	   var url = "report_getJyjyReportUrl.do";
	   $.ajax({
	        cache: true,
	        type: "POST",
	        url:url,
	        data:{"jyjy.id":jyjyId,"isEntry":isEntry,"isTemplate":isTemplate,"printType":printType},// 你的formid 
	        async: false,
	        contentType: "application/x-www-form-urlencoded; charset=utf-8",
	        error: function(request) {
	            $.messager.alert('提示',"与服务器连接错误");
	        },
	        success: function(data) {
	        	var jsonData=eval("("+data+")");
	        	  var jsonData;
	        	   try{
	        	  	 jsonData =eval("("+data+")");
	        	   }catch(e){
	        		   showErrorShowDiv("返回数据错误",data);
	        		   return;
	        	   }
	        	   if(jsonData && jsonData.errorDetail && jsonData.errorDetail !='' ){
	        	   		var errorTitle = "";
	        	   		try{
	        	   			errorTitle = jsonData.error;
	        	   		}catch(e){
	        	   		    errorTitle = "";
	        	   		}
	        		   showErrorShowDiv(errorTitle,jsonData.errorDetail);
	        		   return ;
	        	   }
	        	   
	      	 if(jsonData && jsonData.url && jsonData.url !=""){
	      		 onpenUrl(jsonData.url);
	      	 }else{
	      		  $.messager.alert('提示',"生成报表错误.请联系管理");
	      	 }
	        }
	        	
	    });
   }
   
    function doDeclarePrint(baHgbaseinfoId,isEntry,printType){
       var url = "report_getHgReportUrl.do";
       $.ajax({
            cache: true,
            type: "POST",
            url:url,
            data:{"baHgbaseinfo.id":baHgbaseinfoId,"isEntry":isEntry,"printType":printType},// 你的formid 
            async: false,
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            error: function(request) {
                $.messager.alert('提示',"与服务器连接错误");
            },
            success: function(data) {
                var jsonData=eval("("+data+")");
                  var jsonData;
                   try{
                     jsonData =eval("("+data+")");
                   }catch(e){
                       showErrorShowDiv("返回数据错误",data);
                       return;
                   }
                   if(jsonData && jsonData.errorDetail && jsonData.errorDetail !='' ){
           	   		var errorTitle = "";
           	   		try{
           	   			errorTitle = jsonData.error;
           	   		}catch(e){
           	   		    errorTitle = "";
           	   		}
           		   showErrorShowDiv(errorTitle,jsonData.errorDetail);
           		   return ;
           	   }
                   
             if(jsonData && jsonData.url && jsonData.url !=""){
                 onpenUrl(jsonData.url);
             }else{
                 $.messager.alert('提示',"生成报表错误.请联系管理");
             }
            }
                
        });
   }
   
   function onpenUrl(url){
	   $("#printReportA").attr("href",encodeURI(url))[0].click();
   }